<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div{
      margin: 100px auto;
      text-align: center;
    }
  </style>
</head>
<body>
  <div></div>
  <script>
    var div = document.querySelector('div')
  
    var end = +new Date('2021-8-30 17:00:00')

    function getEndTime() {
      var start = +new Date()
       
      var diff = parseInt((end - start) / 1000)

      var d = parseInt(diff / 60 / 60 / 24)
      var h = parseInt(diff / 60 / 60 % 24)
      var m = parseInt(diff / 60 % 60)
      var s = parseInt(diff % 60)

      var str = d + '天' + h + '时' + m + '分' + s + '秒'

      div.innerText = str
    }

    getEndTime()

    setInterval(getEndTime, 1000)

  </script>
</body>
</html>